Before you can build and deploy Kanzi applications for Android, you need to set up the Kanzi build environment for Android and install on your computer the USB device drivers for your Android device. See Installing the Kanzi build environment for Android.
To build and deploy your Kanzi application to Android from Kanzi Studio:
You can configure the building of your Kanzi applications for Android using the application configurations in Kanzi Studio. For example, you can set the target architecture, and whether Kanzi should deploy the built package to the attached target device. You can set which application configuration you want to use when you select > Export KZB > Build Android Package in > in the Default Build Configuration property.
SCons runs the SConstruct file in the configuration directory of the platform from which you run the scons
command. SConstruct file is the entry point for building the application and contains the information about the Kanzi Engine location and runs these files:
To build and deploy Kanzi applications for Android manually:
scons
command with the build parameters for your Kanzi application.Syntax | scons <library> <type> <name> | ||||||
Parameters |
| ||||||
Examples |
// Builds the application with the default settings as specified
// in config.py and SConstruct configuration files.
scons
// Builds the debug version of the application with
// the OpenGL graphics library.
scons GL debug
// Builds the debug version of the application with the
// OpenGL ES 2.0 graphics library from the Kanzi Studio
// project named MyProject.
scons ES2 debug MyProject |
Scons builds the Kanzi application source code and binary files in the <ProjectName>/Application/output directory.
adb install
or ant release install
to install the .apk package of your Kanzi application on your Android device.adb install MyProject.apk
ant release install
When you receive this error while compiling Kanzi applications for Android:
[dex] Pre-Dexing C:\KanziWorkspace\3rdPartySDKs\android-sdk-windows\tools\support \annotations.jar -> annotations-fa751cd593bf7078e9c18d47a485e852.jar [dx] Error: Could not create the Java Virtual Machine.Error occurred during initialization of VM [dx] Error: A fatal exception has occurred. Program will exit. [dx] [dx] Could not reserve enough space for object heap BUILD FAILED
Limit the max heap size of the dx tool in <KanziWorkspace>/3rdPartySDKs/android-sdk-windows/build-tools/18.1.0/dx.bat. Change the line:
setdefaultXmx=
-Xmx1024M
to
set defaultXmx=-Xmx512M
Class not found: javac1.8
-Dbuild.compiler=javac1.7
Installing the Kanzi build environment for Android